import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/student/login',
    method: 'post',
    data: data
  })
}

export function getInfo(token) {
  return request({
    url: '/student/getInfo',
    method: 'get'
  })
}

export function register(data) {
  return request({
    url: '/student/register',
    method: 'post',
    data: data
  })
}
export function logout() {
  return request({
    url: '/student/logout',
    method: 'post'
  })
}

export function getStudentList(data) {
  return request({
    url: '/student/getStudentList',
    method: 'post',
    data: data
  })
}

export function getStudentInfo(id) {
  return request({
    url: '/student/getStudentInfo/',
    method: 'get',
    params: { id }
  })
}

export function getClassList() {
  return request({
    url: '/student/getClassList/',
    method: 'get'
  })
}

export function getMajorList() {
  return request({
    url: '/student/getMajorList/',
    method: 'get'
  })
}

export function getUserByAccount(account) {
  return request({
    url: '/student/getUserByAccount/',
    method: 'get',
    params: { account }
  })
}

export function updatePassword(data) {
  return request({
    url: '/student/updatePassword',
    method: 'post',
    data: data
  })
}

export function changePassword(data) {
  return request({
    url: '/student/changePassword',
    method: 'post',
    data: data
  })
}

export function checkPassword(data) {
  return request({
    url: '/student/checkPassword',
    method: 'post',
    data: data
  })
}

export function addStudent(data) {
  return request({
    url: '/student/addStudent',
    method: 'post',
    data
  })
}

export function updateStudent(data) {
  return request({
    url: '/student/updateStudent',
    method: 'post',
    data
  })
}

export function deleteStudent(ids) {
  return request({
    url: '/student/deleteStudent/',
    method: 'delete',
    data: ids
  })
}
